// 弹出全屏黑色背景
$("#click-timer-add").live('click', function() {

	$("body").prepend("<div class='quanping' ></div>");
	$(".quanping").height($(document).height());

	$(".timer-frame").fadeIn("slow");

	timerInit();
});

// 关闭多选弹出框
$(".border-close").click(function() {
	$(".timer-frame").fadeOut("slow");
	$(".quanping").remove();
	$(".input_300, .input_250").val("");
});

/**
 * 初始化
 */
function timerInit() {

	var hourhtml = "<select id='timer-hour' name='timer-hour'>"
			+ "<option value='0' checked>0</option>";
	for ( var i = 1; i < 24; i++) {
		hourhtml += "<option value='" + i + "'>" + i + "</option>";
	}
	hourhtml += "</select>小时";

	var minuhtml = "<select id='timer-minu' name='timer-minu'>"
			+ "<option value='0' checked>0</option>";
	for ( var i = 1; i < 60; i++) {
		minuhtml += "<option value='" + i + "'>" + i + "</option>";
	}
	minuhtml += "</select>分钟";

	var secondhtml = "<select id='timer-seco' name='timer-seco'>"
			+ "<option value='0' checked>0</option>";
	for ( var i = 1; i < 60; i++) {
		secondhtml += "<option value='" + i + "'>" + i + "</option>";
	}
	secondhtml += "</select>秒";

	$("#timer-duration").html(
			"本张PPT持续时间:<p>" + hourhtml + minuhtml + secondhtml);

	var h = timer.getH(exam.curNO);
	var m = timer.getM(exam.curNO);
	var s = timer.getS(exam.curNO);
	
	$("#timer-hour").val(h);
	$("#timer-minu").val(m);
	$("#timer-seco").val(s);
}

/**
 * 确定<br>
 * 一张PPT只能添加一个计时器<br>
 * 会覆盖
 */
$(".border-submit-timer").click(
		function() {
			var h = $("#timer-hour").val();
			var m = $("#timer-minu").val();
			var s = $("#timer-seco").val();

			timer.update(exam.curNO,h,m,s);
			
			// 信息显示
			timer.show(exam.curNO);

			$(".timer-frame").fadeOut("slow");
			$(".quanping").remove();
		});

//移除该张PPT的计时器
$("#click-timer-remove").live('click', function() {
	timer.clean(exam.curNO);
	timer.show(exam.curNO);
});